<?php
namespace app\api\validate;

use think\Validate;

class UsersValidate extends Validate{
    protected $rule =   [
        'id'                    => 'require|number',
        'curr|页数'             => 'require|number',
        'limit|条数'            => 'require|number',
        'user_id|用户ID'        => 'require|number',
        'admin_id|店铺ID'       => 'require|number',
        'goods_id|商品ID'       => 'require|number',
        'city|城市'             => 'require|length:1,30',
        'wxcode'                => 'require',
        'phone|手机号'          => 'require|mobile',
        'head_img|头像'         => 'require',
        'nickname|昵称'         => 'require',
        'sessionKey'            => 'require',
        'encryptedData'         => 'require',
        'iv'                    => 'require',
        'scene'                 => 'require',
        'code'                  => 'require',
        'bank_number|银行卡号'   => 'require',
        'bank_name|归属银行'     => 'require',
        'real_name|真实姓名'     => 'require',
        'username|账号'          => 'require',
        'password|密码'          => 'require',
        'number|数量'            => 'require',
        'face|上传图片'          => 'require|image',
        'time|日期'              => 'require|date',
        'unionid|unionid'       => 'require',
    ];
    
    protected $scene = [
        'show'        => ['user_id'],
        'bind'        => ['user_id', 'admin_id'],
        'openid'      => ['wxcode'],
        // 'wxlogin'     => ['openid', 'unionid', 'head_img', 'nickname', 'phone'],
        'wxlogin'     => ['openid', 'head_img', 'nickname', 'phone'],
        'decrypt'     => ['sessionKey', 'encryptedData', 'iv'],
        'codeunlimit' => ['scene'],
        'login'       => ['phone', 'code'],
        'list'        => ['curr', 'limit', 'goods_id'],
        'phone'       => ['phone'],
        'bank'        => ['user_id', 'bank_number', 'bank_name', 'real_name'],
        'bind_shop'   => ['user_id', 'username', 'password'],
        'cash'        => ['user_id', 'number'],
        'line'        => ['user_id', 'curr', 'limit'],
        'card_money'  => ['user_id', 'admin_id', 'number'],
        'face_add'    => ['user_id', 'face'],
        'face'        => ['face'],
        'time'        => ['time'],
        'money_gold'  => ['user_id', 'admin_id'],
    ];
}